package com.vancouver.knows.ui.fragment.citynews;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import com.pangu.task.mark.ATaskMark;
import com.pangu.ui.refresh.ARefreshViewController;
import com.pangu.ui.refresh.RefreshControllerView;
import com.vancouver.knows.business.BusinessModule;
import com.vancouver.knows.MainApplication;

/**
 * 城事下拉界面
 * 
 * @author chenxunlin01
 * 
 */
public class CityNewsCommentsPullControllerView extends RefreshControllerView {

	public CityNewsCommentsPullControllerView(Context context) {
		super(context);
	}

	public CityNewsCommentsPullControllerView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	public void onRefresh(ARefreshViewController controller) {
		((CityNewsCommentsListView) content).handleRefreshLoadItem();
	}

	public void loadData(String postId) {
		BusinessModule module = ((MainApplication) imContext).getBusinessModule();
		ATaskMark aTaskMark = module.getTaskMarkPool().getFetchCommentsTaskMark(postId);
		((CityNewsCommentsListView) content).initLoadableView(aTaskMark);
	}

	public void flush() {
		((CityNewsCommentsListView) content).notifyDataSetChanged();
	}

	@Override
	protected View createContentView() {
		return new CityNewsCommentsListView(getContext(), this);
	}

}
